<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>编辑档案分类信息</title>
    <link rel="stylesheet" type="text/css" href="${params.contextPath}/common/ztree/css/zTreeStyle/zTreeStyle.css"/>
<#include "/common/resource.ftl">
    <script type="text/javascript" src="${params.contextPath}/common/ztree/js/jquery.ztree.all.min.js"></script>
    <script type="text/javascript">
        $(function () {   //回显的操作
        <#if (params.id)??>
            $.ajaxRequest({
                url: '${params.contextPath}/web/archivesCategory/query.json',
                data:{id:"${params.id}"},
                success:function (data) {
                    if (!data.success) {
                        layer.msg(data.message);
                        return;
                    }
                    var record = data.data;
                    for (var key in record) {  //当要回显的字段与表里的字段一样，则直接选用该种方式
                        $("[name='"+key+"']").val(record[key]);
                    }

                    if (record.parentArc) {   //不一致时，则用该种方式
                        $("[name='parentId']").val(record.parentArc.id);
                        $("[name='parentName']").val(record.parentArc.name);
                    }
                }
            });
        </#if>
        });
    </script>
</head>
<body>
<div class="ui-form">
    <form class="layui-form ajax-form" action="${params.contextPath}/web/archivesCategory/<#if (params.id)??>modify<#else>save</#if>.json" method="post">
        <input type="hidden" name="id" value="${params.id}"/>
        <div class="layui-form-item">
            <label class="layui-form-label">分类名称<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" placeholder="请输入分类名称" name="name">
            </div>
        </div>
         
            <div class="layui-form-item">
                <label class="layui-form-label">父级分类</label>
                <div class="layui-input-block">
                    <input type="hidden" name="parentId" value="${params.parentId!'ROOT'}"/>
                    <input type="text" name="parentName" disabled="disabled" value="${params.parentName!'无父级分类'}" class="layui-input ui-disabled"/>
                </div>
            </div>
         
        <div class="layui-form-item">
            <label class="layui-form-label">排序序号<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" placeholder="请输入排序序号" name="ordernum">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">描述</label>
            <div class="layui-input-block">
                <textarea class="layui-textarea" name="remark" placeholder="区域说明，可输入200个字符" maxlength="200"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="submit" value="保存" class="layui-btn"/>
            </div>
        </div>
    </form>
</div>
</body>

</html>
